<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 1.引入vue.js文件 -->
    <script src="js/vue.js"></script>
</head>

<body>
    <!-- 声明式渲染 -->
    <div id="app">
        <p>
            用户名:
            <!-- 监听键盘事件时添加按键修饰符 -->
            <input type="text" v-model="username" @keyup.83.up.down="keyFun">
        </p>
    </div>
    <!-- {{msg}} -->
    <script>
        var app = new Vue({
            // element
            // 挂载元素
            el: '#app',
            // 渲染数据定义
            data: {
                username: ''
            },
            methods: {
                keyFun(e) {
                    console.log(e.keyCode);
                }
            }
        });
    </script>
</body>

</html>